home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-2.iso / extra_2 / imgry10.zip / IMAGERY.H < prev    next >
C/C++ Source or Header  |  1995-10-06  |  7KB  |  190 lines

  1. /*
  2.  * Imagery Version 1.0 Copyright (C) 1995 Ursus Computing Pty. Ltd.
  3.  * Function Headers and Structure Definitions
  4.  * Note that all references to HANDLE's are void* in the 32-bit version
  5.  * and that HANDLE's are unsigned int in the 16-bit version
  6.  */
  7.  
  8. #ifndef __IMAGERY__
  9. #define __IMAGERY__
  10. #include <windows.h>
  11.  
  12. #define FILE_BMP        0    /* Windows compatible Bitmap */
  13. #define FILE_OS2        1    /* OS/2 BMP file */
  14. #define FILE_GIF        2    /* Compuserve GIF (unsupported) */
  15. #define FILE_PPM        3    /* Portable Pixmap */
  16. #define FILE_TGA        5    /* Truevision Targa */
  17. #define FILE_TIFF       6    /* Aldus TIFF Revision 6 */
  18. #define FILE_PSD        7    /* PhotoShop Bitmap (v2.5) */
  19. #define FILE_PCX        8    /* Zsoft PCX */
  20. #define FILE_SGI        9    /* Silicon Graphics image file */
  21. #define FILE_SUNRAS     11    /* Sun Raster file */
  22. #define FILE_PNG        12    /* Portable Network Graphics */
  23. #define FILE_JPEG       13    /* JFIF compatible JPEG */
  24.  
  25. /*
  26.  * Compression types used in File Formats
  27.  */
  28. #define TIFF_NONE            0 /* No compression */
  29. #define TIFF_LZW            1 /* LZW compression */
  30. #define TIFF_PACK            2 /* Packbits compression */
  31. #define TIFF_NEXT            3 /* 2-bit NeXT Compression (unsupported) */
  32. #define TIFF_FAX_G3         4 /* FAX Group 3 compression (unsupported) */
  33. #define TIFF_FAX_G4         5 /* FAX Group 4 compression (unsupported) */
  34. #define TIFF_THUNDERSCAN    6 /* Thunderscan RLE 4-bit (unsupported) */
  35. #define TIFF_RLE            7 /* RLE compression (unsupported) */
  36. #define TIFF_JPEG            8 /* JPEG DCT compression */
  37.  
  38. /*
  39.  * Colour space formats
  40.  */
  41. #define IMG_RGB_24        0 /* 24-bit Red, Green, Blue values */
  42. #define IMG_RGB_8        2 /* 8-bit Paletted */
  43. #define IMG_GRAY_8        5 /* 8-bit Grayscale (gray palette)*/
  44. #define IMG_CMYK        6 /* 32-bit CMYK */
  45. #define IMG_YCbCr        8 /* 24-bit YCbCr/YCC/YUV format (JPEG) */
  46.  
  47. /*
  48.  * JPEG sampling factors
  49.  */
  50. #define SAMPLE_NONE        0 /* No sampling factors (24-bit/grayscale)*/
  51. #define SAMPLE_411        1 /* 4:1:1 sampling factors (24-bit)*/
  52. #define SAMPLE_422        2 /* 4:2:2 sampling factors (24-bit)*/
  53. #define SAMPLE_2112        3 /* 2:1:1:2 sampling factors (CMYK) */
  54. #define SAMPLE_1111        4 /* 1:1:1:1 sampling factors (CMYK) */
  55.  
  56. typedef struct FileInfo{
  57.     int Width;                /* Image width in pixels */
  58.     int Height;                /* Image height in pixels */
  59.     DWORD ImageSize;        /* Image size in bytes when in memory */
  60.     int BitsPerPixel;        /* Bits Per Pixel of Image */
  61.     DWORD FileSize;            /* Size of file on disk */
  62.     int ImageClass;            /* Colour space of image file */
  63.     int FileFormat;            /* Image file format */
  64.     char szComments[80];    /* comments found in file */
  65.     int CompressionRatio;    /* compression ratio (HIBYTE:LOBYTE) */
  66.     int CompressionMethod;    /* compression method (TIFF definitions) */
  67.     HANDLE hPreview;        /* DIB handle of preview */
  68.     DWORD PreviewSize;        /* Size of preview DIB */
  69.     int PreviewWidth;        /* Preview width in pixels */
  70.     int PreviewHeight;        /* Preview height in pixels*/
  71.     BYTE Colormap[3][256];    /* Colormap */
  72.     int JPEGQuality;        /* Approximate quality factor for JPEG */
  73.     int JPEGSampling;        /* JPEG sampling factors */
  74.     LPSTR szJPEGType;        /* Literal description of JPEG encoding */
  75.     BOOL bInterlaced;        /* TRUE if interlaced PNG */
  76.     BOOL bPreview;            /* TRUE if there is a preview image */
  77.     BOOL bReadable;            /* TRUE if readable */
  78.     BOOL bMask;                /* TRUE if a mask/alpha channel was found */
  79. } FileInfo;
  80.  
  81. typedef struct WriteOptions{
  82.     int ImageClass;        /* Colour space */
  83.     BOOL bWriteAlpha;    /* Write an alpha channel (individual libraries only)*/
  84.     BOOL bWritePreview;    /* Write a Preview of pre-calculated dimensions */
  85.     int JPEGQuality;    /* JPEG quality factor */
  86.     int Compression;    /* TIFF compression method */
  87.     int FileFormat;        /* File Format to be output */
  88.     int SegmentSize;    /* TIFF segment size (kb) */
  89.     BOOL bPredictor;    /* LZW predictor for TIFF LZW */
  90.     int JPEGSampling;    /* Sampling factors for JPEG compression */
  91.     LPSTR szComments;    /* Comments to be inserted into file */
  92.     BOOL bInterlaced;    /* Whether a PNG file will be written interlaced */
  93. } WriteOptions;
  94.  
  95.  
  96. /* Initialize Imagery Library */
  97. UINT WINAPI InitLib(UINT,HWND,UINT);
  98.  
  99. /* Perform cleanup of Imagery Library */
  100. int WINAPI EndLib(void);
  101.  
  102. /* 
  103.  * Function headers for File input/output
  104.  */
  105. /* Read any supported file format into a DIB */
  106. HANDLE WINAPI ReadImage(LPSTR);
  107.  
  108. /* Write any supported file format from a 24-bit or 8-bit DIB */
  109. UINT WINAPI WriteImage(LPSTR,HANDLE,WriteOptions*);
  110.  
  111. /* Retrieve information about an image file */
  112. int WINAPI GetFileInfo(LPSTR,FileInfo*);
  113.  
  114. /*
  115.  * Function headers for Image manipulation
  116.  */
  117. /* Retrieve a specific channel from a 24-bit DIB */
  118. HANDLE WINAPI GetChannel(HANDLE,int);
  119.  
  120. /* Set a specific channel in a 24-bit DIB */
  121. HANDLE WINAPI PutChannel(HANDLE,HANDLE,int);
  122.  
  123. /* Combine 3 channels to form a 24-bit DIB */
  124. HANDLE WINAPI CombineChannels(HANDLE,HANDLE,HANDLE);
  125.  
  126. /* Convert the colour space of a DIB */
  127. HANDLE WINAPI ColorConvert(HANDLE,int);
  128.  
  129. /* Adjust the gamma of a DIB */
  130. HANDLE WINAPI GammaCorrect(HANDLE,float,float,float);
  131.  
  132. /* Adjust the gamma of a DIB (red,green and blue can be different) */
  133. //HANDLE WINAPI ColorCorrect(HANDLE,float,float,float);
  134.  
  135. /* Add distributed/random noise to a 24-bit DIB */
  136. HANDLE WINAPI AddNoise(HANDLE,int,int);
  137.  
  138. /* Crop a DIB to new dimensions */
  139. HANDLE WINAPI CropImage(HANDLE,RECT);
  140.  
  141. /* Scatter the pixels of a DIB */
  142. HANDLE WINAPI DisplaceImage(HANDLE,int);
  143.  
  144. /* Flip a DIB vertically or horizontally */
  145. HANDLE WINAPI FlipImage(HANDLE,int);
  146.  
  147. /* Invert the pixels of a DIB */
  148. HANDLE WINAPI InvertImage(HANDLE);
  149.  
  150. /* Rotate a DIB by an arbitrary angle (with anti-aliasing) */
  151. HANDLE WINAPI RotateImage(HANDLE,float);
  152.  
  153. /* Resize a DIB using the Windows GDI */
  154. HANDLE WINAPI ResizeImage(HANDLE,int,int);
  155.  
  156. /* Emboss a DIB */
  157. HANDLE WINAPI EmbossImage(HANDLE,BYTE);
  158.  
  159. /* Unimplemented */
  160. /*HANDLE WINAPI RemoveNoise(HANDLE,int);*/
  161.  
  162. /* Normalize the pixels of a DIB */
  163. HANDLE WINAPI NormalizeImage(HANDLE);
  164.  
  165. /* Equalize the pixels of a DIB */
  166. HANDLE WINAPI EqualizeImage(HANDLE);
  167.  
  168. /* Resample (resize) a DIB with greater quality */
  169. HANDLE WINAPI ResampleImage(HANDLE,int,int);
  170.  
  171. /* Detects the edges of an image */
  172. HANDLE WINAPI DetectEdges(HANDLE);
  173.  
  174. /* Sharpen DIB */
  175. HANDLE WINAPI SharpenImage(HANDLE,int);
  176.  
  177. /* Blur a DIB */
  178. HANDLE WINAPI BlurImage(HANDLE,int);
  179.  
  180. /* Average a DIB */
  181. HANDLE WINAPI AverageImage(HANDLE,int);
  182.  
  183. /* Apply a 5x5 matrix to a DIB (registered version) */
  184. HANDLE WINAPI FilterImage(HANDLE,int,int,int*);
  185.  
  186. /* Alter brightness and contrast levels of a DIB */
  187. HANDLE WINAPI TuneImage(HANDLE,int*,int*,int);
  188.  
  189. #endif /* __IMAGERY__ */
  190.